package cn.gzjp.modules.rice.entity;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonFormat;

import cn.gzjp.common.persistence.DataEntity;
import cn.gzjp.common.utils.excel.annotation.ExcelField;
import org.hibernate.validator.constraints.Length;

/**
 * 订单Entity
 * @author zengcp
 * @version 2018-11-17
 */
public class RiceOrder extends DataEntity<RiceOrder> {
	
	private static final long serialVersionUID = 1L;
	private String openid;		// 买家openid
	private BigDecimal totalPrice;		// 总价
	private Integer buyState;		// 订单状态：0新订单(待支付)，1订单已支付，2取消
	private Date buyTime;		// 下单时间
	private String buyerMemo;		// 订单备注
	private String signer;		// 收件人
	private String address;		// 收件地址
	private String province;		// 收件人所在省
	private String city;		// 城市
	private String area;		// 区
	private String phone;		// 收件人手机号
	private String deliveryCompany;		// 物流公司
	private String deliverySeq;		// 物流号
	private Integer deliveryState;		// 发货状态：0待发货、1已发货、2已签收
	private Date deliveryTime;		// 发货时间
	private Date signTime;		// 签收时间
	private String wxOrderId;		// 微信订单id
	private Date wxPayNotifyTime;		// 微信通知回调时间

	private List<RiceOrderDetail> orderDetailList;
	
	public RiceOrder() {
		super();
	}

	public RiceOrder(String id){
		super(id);
	}

	@ExcelField(title="买家openid", align=2, sort=1)
	public String getOpenid() {
		return openid;
	}

	public void setOpenid(String openid) {
		this.openid = openid;
	}
	
	@ExcelField(title="总价", align=2, sort=2)
	public BigDecimal getTotalPrice() {
		return totalPrice;
	}

	public void setTotalPrice(BigDecimal totalPrice) {
		this.totalPrice = totalPrice;
	}
	
	@ExcelField(title="订单状态：0新订单(待支付)，1订单已支付，2取消", dictType="buy_state", align=2, sort=3)
	public Integer getBuyState() {
		return buyState;
	}

	public void setBuyState(Integer buyState) {
		this.buyState = buyState;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@ExcelField(title="下单时间", align=2, sort=4)
	public Date getBuyTime() {
		return buyTime;
	}

	public void setBuyTime(Date buyTime) {
		this.buyTime = buyTime;
	}
	
	@ExcelField(title="订单备注", align=2, sort=5)
	public String getBuyerMemo() {
		return buyerMemo;
	}

	public void setBuyerMemo(String buyerMemo) {
		this.buyerMemo = buyerMemo;
	}
	
	@Length(min=0, max=128, message="收件人长度必须介于 0 和 128 之间")
	@ExcelField(title="收件人", align=2, sort=6)
	public String getSigner() {
		return signer;
	}

	public void setSigner(String signer) {
		this.signer = signer;
	}
	
	@ExcelField(title="收件地址", align=2, sort=7)
	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}
	
	@ExcelField(title="收件人所在省", align=2, sort=8)
	public String getProvince() {
		return province;
	}

	public void setProvince(String province) {
		this.province = province;
	}
	
	@ExcelField(title="城市", align=2, sort=9)
	public String getCity() {
		return city;
	}

	public void setCity(String city) {
		this.city = city;
	}
	
	@ExcelField(title="区", align=2, sort=10)
	public String getArea() {
		return area;
	}

	public void setArea(String area) {
		this.area = area;
	}
	
	@Length(min=0, max=20, message="收件人手机号长度必须介于 0 和 20 之间")
	@ExcelField(title="收件人手机号", align=2, sort=11)
	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}
	
	@ExcelField(title="物流公司", align=2, sort=12)
	public String getDeliveryCompany() {
		return deliveryCompany;
	}

	public void setDeliveryCompany(String deliveryCompany) {
		this.deliveryCompany = deliveryCompany;
	}
	
	@ExcelField(title="物流号", align=2, sort=13)
	public String getDeliverySeq() {
		return deliverySeq;
	}

	public void setDeliverySeq(String deliverySeq) {
		this.deliverySeq = deliverySeq;
	}
	
	@ExcelField(title="发货状态：0待发货、1已发货、2已签收", dictType="delivery_state", align=2, sort=14)
	public Integer getDeliveryState() {
		return deliveryState;
	}

	public void setDeliveryState(Integer deliveryState) {
		this.deliveryState = deliveryState;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@ExcelField(title="发货时间", align=2, sort=15)
	public Date getDeliveryTime() {
		return deliveryTime;
	}

	public void setDeliveryTime(Date deliveryTime) {
		this.deliveryTime = deliveryTime;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@ExcelField(title="签收时间", align=2, sort=16)
	public Date getSignTime() {
		return signTime;
	}

	public void setSignTime(Date signTime) {
		this.signTime = signTime;
	}
	
	@Length(min=0, max=64, message="微信订单id长度必须介于 0 和 64 之间")
	@ExcelField(title="微信订单id", align=2, sort=17)
	public String getWxOrderId() {
		return wxOrderId;
	}

	public void setWxOrderId(String wxOrderId) {
		this.wxOrderId = wxOrderId;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@ExcelField(title="微信通知回调时间", align=2, sort=18)
	public Date getWxPayNotifyTime() {
		return wxPayNotifyTime;
	}

	public void setWxPayNotifyTime(Date wxPayNotifyTime) {
		this.wxPayNotifyTime = wxPayNotifyTime;
	}

	public List<RiceOrderDetail> getOrderDetailList() {
		return orderDetailList;
	}

	public void setOrderDetailList(List<RiceOrderDetail> orderDetailList) {
		this.orderDetailList = orderDetailList;
	}
}